home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / NEWSOFT / AUGUST / FREENET2 / !FreeNet / Docs / Firewalls < prev    next >
Text File  |  1996-10-13  |  4KB  |  107 lines

  1.                 Firewalls using the FreeNet TCP/IP Stack
  2.  
  3.                           (C) Tom Hughes 1996
  4.  
  5. 0. Copyright
  6.  
  7.   The FreeNet module and application and the tools and documentation
  8.   that go with them are all copyright. They are however released as
  9.   freeware subject to certain terms and conditions. These are described
  10.   in the file named 'Licence' which should have accompanied this
  11.   document.
  12.  
  13. 1. Overview
  14.  
  15.   The firewall facilities in FreeNet allow you to control who can
  16.   access systems running on your machine or on other machines that
  17.   are the FreeNet system is acting as a router for.
  18.  
  19.   They also allow a FreeNet machine to masquerade the connections
  20.   of other machines which are routed via it - that is to say it can
  21.   rewrite packet headers so that packets passed on to other systems
  22.   look like they came from the FreeNet system, and inbound packets
  23.   to the FreeNet system are (if necessary) passed on to the real
  24.   destination.
  25.  
  26. 2. Enabling the Firewalls
  27.  
  28.   The first step that you need to take to enable firewall and/or
  29.   masquerading is to set the 'ip firewall' option to on, either
  30.   in the configuration file or using netconf - see the 'Tuning'
  31.   file in this directory for more details.
  32.  
  33.   If you wish to use masqeruading you will also need to set a
  34.   second option (ip masquerading) to on in the same way - note
  35.   that the firewall must also be enabled for masquerading to work.
  36.  
  37. 3. Configuring the Firewalls
  38.  
  39.   There are three firewalls available - the input firewall, which
  40.   acts on all packets received by the system; the output firewall,
  41.   which acts on all packets sent by the system; and the forwarding
  42.   firewall which only acts on those packets being forwarded to other
  43.   systems.
  44.  
  45.   There are also three possible actions that a firewall can take
  46.   with a packet - it can accept it, allowing it to pass; it can
  47.   reject it, throwing it away and sending an error message to the
  48.   originating system; or it can deny it, dropping it silently.
  49.  
  50.   By default, both firewalls allow all packets to pass - this can
  51.   be changed by using the ipfw command, as follows:
  52.  
  53.       ipfw policy <firewall> <action>
  54.  
  55.   Where <firewall> is either 'input', 'output' or 'forwarding', and
  56.   <action> is one of 'accept', 'deny' or 'reject'.
  57.  
  58.   This default policy can be overridden by adding specific rules
  59.   to the firewall for particular source/destination addresses:
  60.  
  61.       ipfw add <firewall> <action> <type> [iface <interface>]
  62.                from <address>[/<bits>] [<port>[:<port>]]
  63.                to <address>[/<bits>] [<port>[:<port>]]
  64.  
  65.   Where <type> is one of 'all', 'icmp', 'udp' or 'tcp'. Note that
  66.   a port number or port number range may only be given for udp and
  67.   tcp firewalls.
  68.  
  69.   If an address is not qualified with a significant length in bits
  70.   then only that exact address will be matched. An address of 'default'
  71.   may be specified to match any address.
  72.  
  73.   The firewall list is always scanned in the order that entries were
  74.   added until a match is found, so the most specific entries should 
  75.   always be added first. If you make a mistake and need to start
  76.   again, you can remove all the entries as follows:
  77.  
  78.       ipfw flush <firewall>
  79.  
  80.   The list of entries which make up a firewall can be seen by using
  81.   the following command:
  82.  
  83.       ipfw list <firewall>
  84.  
  85.   Any packets which are blocked by a firewall will be logged in the
  86.   log file as warnings - set the 'log level' option to be 'info' or
  87.   'warning' to see them.
  88.  
  89. 4. Configuring Masquerading
  90.  
  91.   Masquerading relies on the forwarding firewall to work - entries
  92.   are created in the forwarding firewall with a special masquerading
  93.   flag set by using the following command:
  94.  
  95.       ipfw add masquerade <type> [iface <interface>]
  96.                from <address>[/<bits>] [<port>[:<port>]]
  97.                to <address>[/<bits>] [<port>[:<port>]]
  98.  
  99.   Any packet being forwarded by FreeNet which matches one of these
  100.   entries in the firewall will be masqueraded so that it appears
  101.   to come from the FreeNet system, and replies will be forwarded
  102.   back to the real originator of the packets.
  103.  
  104.   Because masquerading uses the forwarding firewall, listing that
  105.   firewall will list the masquerade entries, and flushing it will
  106.   delete them.
  107.